package com.zc58s.springbootmqtt.mqtt.distributor;

import com.zc58s.springbootmqtt.mqtt.distributor.service.IDistributorService;
import com.zc58s.springbootmqtt.mqtt.vo.SubcribeRes;
import com.zc58s.springbootmqtt.utils.SpringContextUtil;

/**
 * @author : fujc-dev@qq.com
 * @created : 2022/9/22 14:13
 */

public class Exector implements Runnable {

    private SubcribeRes res;

    public Exector(SubcribeRes res) {
        this.res = res;
    }

    @Override
    public void run() {
        // 利用Spring的IOC功能进行处理分发
        IDistributorService distributorService = SpringContextUtil.getBean(this.res.getTopic());
        distributorService.distributor(res);
    }
}
